﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="popup.aspx.cs" Inherits="popup" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="jquery.js"></script>
    
        <script type="text/javascript">
            function load(txt, textboxid, key) {

                //txt gia tri can truyen ve 
                //textbox trang chinh dc nhan gia tri tu trang popup
                //key=1 postback trang chinh
                window.opener.$("#" + textboxid).val(txt);
                if (key == "1") {
                    window.opener.__doPostBack('', '');
                }
                window.close();
            }

            //ghep chuoi vat tu
            function chon(btextboxid) {
                var s = "";
                $('input:checkbox').each(function () {
                    if (this.checked == true) {
                        var a = $(this).parent().next().children().html();
                        s = s + a + " ";
                    }

                });
                load(s, btextboxid, "1");            
            }
        </script>
    
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="gv" runat="server">
            <Columns>
                <asp:TemplateField HeaderText="chon" >
                    <ItemTemplate>
                        <asp:CheckBox ID="ck" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
               
            </Columns>
        </asp:GridView>
        <asp:HyperLink ID="lbh" runat="server" Text="chon" NavigateUrl="#"  ></asp:HyperLink>
        <asp:Label ID="lbscript" runat="server"></asp:Label>
    </div>
    </form>
</body>
</html>
